package com.park.common.poo;

import javax.persistence.*;

import java.util.List;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * Created by Administrator on 2017-04-30.
 */
@Entity
@Table(name = "system_menu", schema = "", catalog = "totem")
public class SystemMenu {
    private Integer menuId;
    private String menuCode;
    private String menuName;
    private Integer menuSort;
    private String menuUrl;
    private String menuStatus;
    private Integer parentMenuId;
    private Integer parentMenuSort;
    private String isQuick;

    @Transient
    private List<SystemMenu> menuList;

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "menuId")
    public Integer getMenuId() {
        return menuId;
    }

    public void setMenuId(Integer menuId) {
        this.menuId = menuId;
    }

    @Basic
    @Column(name = "menuCode")
    public String getMenuCode() {
        return menuCode;
    }

    public void setMenuCode(String menuCode) {
        this.menuCode = menuCode;
    }

    @Basic
    @Column(name = "menuName")
    public String getMenuName() {
        return menuName;
    }

    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    @Basic
    @Column(name = "menuSort")
    public Integer getMenuSort() {
        return menuSort;
    }

    public void setMenuSort(Integer menuSort) {
        this.menuSort = menuSort;
    }

    @Basic
    @Column(name = "menuURL")
    public String getMenuUrl() {
        return menuUrl;
    }

    public void setMenuUrl(String menuUrl) {
        this.menuUrl = menuUrl;
    }

    @Basic
    @Column(name = "menuStatus")
    public String getMenuStatus() {
        return menuStatus;
    }

    public void setMenuStatus(String menuStatus) {
        this.menuStatus = menuStatus;
    }

    @Basic
    @Column(name = "parentMenuId")
    public Integer getParentMenuId() {
        return parentMenuId;
    }

    public void setParentMenuId(Integer parentMenuId) {
        this.parentMenuId = parentMenuId;
    }

    @Basic
    @Column(name = "parentMenuSort")
    public Integer getParentMenuSort() {
        return parentMenuSort;
    }

    public void setParentMenuSort(Integer parentMenuSort) {
        this.parentMenuSort = parentMenuSort;
    }

    @Basic
    @Column(name = "isQuick")
    public String getIsQuick() {
        return isQuick;
    }

    public void setIsQuick(String isQuick) {
        this.isQuick = isQuick;
    }

    @Transient
    public List<SystemMenu> getMenuList() {
        return menuList;
    }

    @Transient
    public void setMenuList(List<SystemMenu> menuList) {
        this.menuList = menuList;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SystemMenu that = (SystemMenu) o;

        if (menuId != that.menuId) return false;
        if (menuCode != null ? !menuCode.equals(that.menuCode) : that.menuCode != null) return false;
        if (menuName != null ? !menuName.equals(that.menuName) : that.menuName != null) return false;
        if (menuSort != null ? !menuSort.equals(that.menuSort) : that.menuSort != null) return false;
        if (menuUrl != null ? !menuUrl.equals(that.menuUrl) : that.menuUrl != null) return false;
        if (menuStatus != null ? !menuStatus.equals(that.menuStatus) : that.menuStatus != null) return false;
        if (parentMenuId != null ? !parentMenuId.equals(that.parentMenuId) : that.parentMenuId != null) return false;
        if (parentMenuSort != null ? !parentMenuSort.equals(that.parentMenuSort) : that.parentMenuSort != null)
            return false;
        if (isQuick != null ? !isQuick.equals(that.isQuick) : that.isQuick != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = menuId;
        result = 31 * result + (menuCode != null ? menuCode.hashCode() : 0);
        result = 31 * result + (menuName != null ? menuName.hashCode() : 0);
        result = 31 * result + (menuSort != null ? menuSort.hashCode() : 0);
        result = 31 * result + (menuUrl != null ? menuUrl.hashCode() : 0);
        result = 31 * result + (menuStatus != null ? menuStatus.hashCode() : 0);
        result = 31 * result + (parentMenuId != null ? parentMenuId.hashCode() : 0);
        result = 31 * result + (parentMenuSort != null ? parentMenuSort.hashCode() : 0);
        result = 31 * result + (isQuick != null ? isQuick.hashCode() : 0);
        return result;
    }
}
